import $ from './library/jquery.js';


$.ajax({
    type: "get",
    url: "../../interface/getData.php",
    dataType: "json",
    success: function (res) {
        // console.log(res)
            let temp = '';
            res.forEach((elm, i) => {
                let picture = JSON.parse(elm.picture);
                // console.log(picture);
                temp += `<li class="item">
            <a href="./product.html?id=${elm.id}">
                <img src="../${picture[0].src}" alt="" class="lazy"  style="width:160px;height:160px;">
                <p class="desc">${elm.title.slice(0,60)+' ...'}</p>
                <p class="price"><span>${elm.price}</span><span>元</span</p>
            </a>
        </li>`;
            });
            // console.log(temp)
            $('.list').html(temp);

    }
});


